# -*- coding:utf-8 -*-
# @file：add_member_page.py
# @Time： 23:20
# @Author：Zhang Jinxia
from selenium.webdriver.common.by import By
from po_project.po_project_param.page.base_page import BasePage

class AddMemberPage(BasePage):
    # 实现定位元素单独维护
    _username=(By.ID,"username")
    _memberAdd_english_name=(By.ID,"memberAdd_english_name")
    _memberAdd_acctid=(By.ID,"memberAdd_acctid")
    _memberAdd_phone=(By.ID,"memberAdd_phone")
    _click_save=(By.CSS_SELECTOR,".js_btn_save")

    def add_member(self,username,english_name,account_number,phone_number):
        """
        添加成员操作
        :return: 返回通讯录页面的对象
        """
        from po_project.po_project_param.page.contact_page import ContactPage
        # 输入名称
        # self.find(self._username).send_keys(username)
        self.find(self._username).send_keys(username)
        self.find(self._memberAdd_english_name).send_keys(english_name)
        # 输入账号
        self.find(self._memberAdd_acctid).send_keys(account_number)
        # 输入手机号
        self.find(self._memberAdd_phone).send_keys(phone_number)
        # 点击保存
        self.find(self._click_save).click()
        # 返回通讯录页面
        return ContactPage(self.driver)